<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Accuser_model extends CI_Model
{
	
	public function __construct()
	{
		parent::__construct();
		$data=array();

	} 	
		
	public function create_user_type($insert)
	{
		$this->db->insert('user_type',$insert);
	}
	
	public function create_department($insert)
	{
		$this->db->insert('department',$insert);
	}
	
	public function add_group($name,$parent,$additional_data){
		
		$data = array(
			    'name'   => $name,
				'parent'   => $parent
		 );
		// print_r($data);exit;
		$this->db->insert('acc_group',$data);
			
	}
		
	public function get_group(){
		
		$query = $this->db->get('acc_group');

		return $query;
	}	


	public function get_groupList(){
		//echo "i am here";exit;
		$query = $this->db->get('acc_group');
	return $query;

		
		
		} 

public function get_uniquegroup($id){
	$query = $this->db->get_where('acc_group', array('id' => $id));
	return $query;

	}

public function register($username, $password, $email, $additional_data){
		
		$data = array(
			    'username'   => $username,
				'password'   => $password,
				'email'   => $email,
		 );
	
		$this->db->insert('acc_user',$data);
	}

public function get_users(){
	
		$query = $this->db->get('acc_user');
	return $query;
}

public function edit_user($id){
	//echo "i am here";exit;
	
$query = $this->db->get_where('acc_user', array('id' => $id));
return $query;
	
	
	}
public function update($edit_id, $data){
		$this->db->update('acc_user',$data,array('id'=>$edit_id));
	}

public function delete($id){
		$this->db->delete('acc_user',array('id'=>$id));		
	}


}
